/**

This file is part of MaCI/GIMnet.

MaCI/GIMnet is free software: you can redistribute it and/or modify it 
under the terms of the GNU Lesser General Public License as published 
by the Free Software Foundation, either version 3 of the License, or 
(at your option) any later version.

MaCI/GIMnet is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
License for more details.

You should have received a copy of the GNU Lesser General Public 
License along with GIMnet. (See COPYING.LESSER) If not, see 
<http://www.gnu.org/licenses/>.

**/
#ifndef GIMI_PROTOCOL_TYPES_H
#define GIMI_PROTOCOL_TYPES_H


/**
 * This file defines the protocol types used in GIMI software
 * You should also add name and description for new datatypes in
 * datatypedescriptions.h
 */

/**
 * ID-values used in GIMI.
 */
// range of allowed id-numbers for users of GIMI.
#ifndef GIMI_ID_MIN
  #define GIMI_ID_MIN                               100
#endif
#ifndef GIMI_ID_MAX
  #define GIMI_ID_MAX                               INT32_MAX
#endif

/**
 * Types used by GIMI.
 */
#define GIMI_PROTOCOL_CLIENT_DESCRIPTION            0
#define GIMI_PROTOCOL_GIMI_HUB_STATUS               1

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///// The Application Protocol specifications under here 
///// Comment the datatypes to folder datatypes/
///// If you want to have working name and description for a datatype,
///// add/edit them in datatypedescriptions.h
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#define GIMI_PROTOCOL_AVANT_REPLY_V3                (GIMI_ID_MIN + 1)	///< The Avant produces this reply data
#define GIMI_PROTOCOL_AVANT_CMD_V3                  (GIMI_ID_MIN + 2)	///< The Avant is commanded with this data
#define GIMI_PROTOCOL_JPEG_WITH_TIMESTAMP           (GIMI_ID_MIN + 3)	///< The Images are sent to teleoperator in this format
#define GIMI_PROTOCOL_UDPFW_FRAME                   (GIMI_ID_MIN + 4)	///< UDP forwarder frame (Generic)
#define GIMI_PROTOCOL_AVANTSIMULATORSTATE_V1        (GIMI_ID_MIN + 5)	///< Avant Simulator state 
#define GIMI_PROTOCOL_BITMAP_WITH_TIMESTAMP         (GIMI_ID_MIN + 6)	///< Bitmap data is sent in this format e.g. RGB images
#define GIMI_PROTOCOL_AUDIO_PCM                     (GIMI_ID_MIN + 7)   ///< PCM audio (raw uncompressed)
#define GIMI_PROTOCOL_AVANT_SIMCMD                  (GIMI_ID_MIN + 8)	///< The Avant Simulator is commanded with this data
#define GIMI_PROTOCOL_GIMNOTIFIER_MESSAGE           (GIMI_ID_MIN + 9)   ///< GIMNotifier message
#define GIMI_PROTOCOL_IMAGESERVER_CTRL              (GIMI_ID_MIN + 10)  ///< Imageserver control package
#define GIMI_PROTOCOL_BITMAP_NET_VECTOR             (GIMI_ID_MIN + 11)  ///< Many bitmap images combined to one
#define GIMI_PROTOCOL_J2B2GIMICTRL_MSG              (GIMI_ID_MIN + 12)  ///< Message for J2B2GIMICtrl 'SimpleGIMI' interface

#define GIMI_PROTOCOL_LAUNCHER_EXECUTE              (GIMI_ID_MIN + 13) ///<Launcher Execute command
#define GIMI_PROTOCOL_LAUNCHER_KILL                 (GIMI_ID_MIN + 14)    ///<Launcher Kill command
#define GIMI_PROTOCOL_LAUNCHER_PROGRAM_STATE        (GIMI_ID_MIN + 15) ///< Launcher State service

#define GIMI_PROTOCOL_MULTIROBOT_MESSAGE            (GIMI_ID_MIN + 16) ///< A messaging service in multirobot system

#define GIMI_PROTOCOL_GRID                          (GIMI_ID_MIN + 17) ///< Grid data over GIM
#define GIMI_PROTOCOL_TTS                           (GIMI_ID_MIN + 18) ///< TTS ID
#define GIMI_PROTOCOL_J2B2GIMICTRL_UI_GASLEVEL      (GIMI_ID_MIN + 19) ///< Message for GASLEVEL (AS-84.3147 special type)
#define GIMI_PROTOCOL_GYPE                          (GIMI_ID_MIN + 20) ///< Defines our public interface
#define GIMI_PROTOCOL_TEXT                          (GIMI_ID_MIN + 21) ///< String/text stream
#define GIMI_PROTOCOL_FSR09ERPCOMM                  (GIMI_ID_MIN + 22) ///< FSR09 course ERP Communication protocol.
#define GIMI_PROTOCOL_SERIALLINK                    (GIMI_ID_MIN + 23) ///< SerialLink protocol (GIMnetApps/SerialLink)
#define GIMI_PROTOCOL_GIMCLUSTER_MASTER             (GIMI_ID_MIN + 24) ///< GIMCluster (GIMnetApps/GIMCluster)
#define GIMI_PROTOCOL_GIMCLUSTER_COMPUTINGNODE      (GIMI_ID_MIN + 25) ///< GIMCluster (GIMnetApps/GIMCluster)
#define GIMI_PROTOCOL_GIMNETBENCH_THROUGHPUT        (GIMI_ID_MIN + 26) ///< GIMnetBench Through test type
#define GIMI_PROTOCOL_GIMNETBENCHMARKS              (GIMI_ID_MIN + 27) ///< GIMnetBench Through test type
#define GIMI_PROTOCOL_NETCAVE                       (GIMI_ID_MIN + 28) ///< NetCave protocol (a game that uses GIMI)
#define GIMI_PROTOCOL_FSR2011ORDERSYSTEM            (GIMI_ID_MIN + 29) ///< FSR2011 course extra kilke protocol


///////////////////////////// BASE TYPES HERE (1100-1200) ////////////////////////////////////////////////
#define GIMI_PROTOCOL_BASE_TYPES_ID_FIRST           (1000+GIMI_ID_MIN) ///< Base types (something that is expected to be used in many modules) 
#define GIMI_PROTOCOL_BASE_TYPES_ID_LAST            (1100+GIMI_ID_MIN) ///< Base types (something that is expected to be used in many modules) 
#define GP_BASE_TYPE(x)                             (GIMI_PROTOCOL_BASE_TYPES_ID_FIRST+x)
#define GIMI_PROTOCOL_COORD2D                       GP_BASE_TYPE(0) ///< (x,y)-coordinate pair
//////////////////////////////////////////////////////////////////////////////////////////////

#define GIMI_PROTOCOL_PTU_POSITION_COMMAND	    (GIMI_ID_MIN + 2000)///<J2B2 PTU Command
#define GIMI_PROTOCOL_RC_POSITION_COMMAND	    (GIMI_ID_MIN + 2001)///< RC command used by the PTU server (unsigned char[2] = servoid, position)


#define GIMI_PROTOCOL_GIMDB_IDFIRST                 (GIMI_ID_MIN + 3000) ///< GIMdb reserved IDs, all between 3000-3500
#define GIMI_PROTOCOL_GIMDB                         (GIMI_PROTOCOL_GIMDB_IDFIRST) ///< GIMdb protocol
#define GIMI_PROTOCOL_GIMDB_IDLAST                  (GIMI_ID_MIN + 3500) ///< GIMdb reserved IDs, all between 3000-3500

#define GIMI_PROTOCOL_BENCHMARK_IDFIRST             (GIMI_ID_MIN + 3501) ///< Benchmarking packets (3501-3599)
#define GIMI_PROTOCOL_BENCHMARK_IDLAST              (GIMI_ID_MIN + 3599)

#define GIMI_PROTOCOL_GROUNDMODEL_IDFIRST           (GIMI_ID_MIN + 3600) ///< Ground Model control packets (3600-3699)
#define GIMI_PROTOCOL_GROUNDMODEL_IDLAST            (GIMI_ID_MIN + 3699) ///< Ground Model control packets (3600-3699)

///////////////////////////////////////////////////////////////////////////////
//// ASRobo Server datatypes //////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#define GIMI_PROTOCOL_ASROBO_IDFIRST                (GIMI_ID_MIN + 10000) ///< ASRobo reserved IDs, ALL between 10000-19999!
#define GIMI_PROTOCOL_ASROBO_EVENT_MAX              (32)                 ///< Maximum number of Events per Command
#define GIMI_PROTOCOL_ASROBO_CMDBASE                (GIMI_PROTOCOL_ASROBO_IDFIRST) ///< Base number for Interface numbers
#define GIMI_PROTOCOL_ASROBO_CMD(x)                 (GIMI_PROTOCOL_ASROBO_CMDBASE + (GIMI_PROTOCOL_ASROBO_EVENT_MAX * (x)))
#define GIMI_PROTOCOL_ASROBO_CMD_RANGING            (GIMI_PROTOCOL_ASROBO_CMD(1)) ///< Ranging Command
#define GIMI_PROTOCOL_ASROBO_CMD_POSITION           (GIMI_PROTOCOL_ASROBO_CMD(2)) ///< Position Command
#define GIMI_PROTOCOL_ASROBO_CMD_LOCALIZE           (GIMI_PROTOCOL_ASROBO_CMD(3)) ///< Localize Command
#define GIMI_PROTOCOL_ASROBO_CMD_IO                 (GIMI_PROTOCOL_ASROBO_CMD(4)) ///< IO Command
#define GIMI_PROTOCOL_ASROBO_CMD_CTRL_DRIVE2D       (GIMI_PROTOCOL_ASROBO_CMD(5)) ///< Ctrl::Drive2D command
#define GIMI_PROTOCOL_ASROBO_CMD_CTRL_JOINTCONTROL  (GIMI_PROTOCOL_ASROBO_CMD(7)) ///< Ctrl::JointControl command
#define GIMI_PROTOCOL_ASROBO_EVENT(x,y)             (GIMI_PROTOCOL_ASROBO_CMD(x) + (y)) ///< Macro to calculate Event id
#define GIMI_PROTOCOL_ASROBO_EVENT_POSITION_ODOMETRY (GIMI_PROTOCOL_ASROBO_CMD_POSITION + 1) /// Position::Odometry event
#define GIMI_PROTOCOL_ASROBO_EVENT_RANGING_DISTANCEARRAY (GIMI_PROTOCOL_ASROBO_CMD_RANGING + 1) /// Ranging::DistanceArray event
#define GIMI_PROTOCOL_ASROBO_IDLAST                 (GIMI_ID_MIN + 19999) ///< ASRobo reserved IDs, ALL between 10000-19999!
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//Protocols used by FSRSim
#define GIMI_PROTOCOL_FSRSIM_POSITION               (GIMI_ID_MIN+20000)
#define GIMI_PROTOCOL_FSRSIM_MOTORCMD               (GIMI_ID_MIN+20001)
#define GIMI_PROTOCOL_FSRSIM_RANGING                (GIMI_ID_MIN+20002)
#define GIMI_PROTOCOL_FSRSIM_OBJECT_REPOSITION      (GIMI_ID_MIN+20003)
#define GIMI_PROTOCOL_FSRSIM_SIMCTRLOBJECT          (GIMI_ID_MIN+20004)

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////
//// MaCI Interface Datatypes (parsers can be found from 'MaCI/interfaces') ///
///////////////////////////////////////////////////////////////////////////////
#define GIMI_PROTOCOL_MACI_IDFIRST                  (GIMI_ID_MIN + 30000)
#define GIMI_PROTOCOL_MACI_SERVERFIRST              (GIMI_PROTOCOL_MACI_IDFIRST + 0) // First available service number
#define GIMI_PROTOCOL_MACI_MACICTRL                 (GIMI_PROTOCOL_MACI_IDFIRST + 0) // First ID is 30100
#define GIMI_PROTOCOL_MACI_RANGING                  (GIMI_PROTOCOL_MACI_IDFIRST + 1) 
#define GIMI_PROTOCOL_MACI_SPEEDCTRL                (GIMI_PROTOCOL_MACI_IDFIRST + 2)
#define GIMI_PROTOCOL_MACI_TEXT                     (GIMI_PROTOCOL_MACI_IDFIRST + 3)
#define GIMI_PROTOCOL_MACI_POSITION                 (GIMI_PROTOCOL_MACI_IDFIRST + 4)
#define GIMI_PROTOCOL_MACI_IO                       (GIMI_PROTOCOL_MACI_IDFIRST + 5)
#define GIMI_PROTOCOL_MACI_COORDINATEDRIVE          (GIMI_PROTOCOL_MACI_IDFIRST + 6)
#define GIMI_PROTOCOL_MACI_JOINTGROUPCTRL           (GIMI_PROTOCOL_MACI_IDFIRST + 7)
#define GIMI_PROTOCOL_MACI_MAP                      (GIMI_PROTOCOL_MACI_IDFIRST + 8)
#define GIMI_PROTOCOL_MACI_BEHAVIOUR                (GIMI_PROTOCOL_MACI_IDFIRST + 9)
#define GIMI_PROTOCOL_MACI_IMAGE                    (GIMI_PROTOCOL_MACI_IDFIRST + 10)
#define GIMI_PROTOCOL_MACI_ALARM                    (GIMI_PROTOCOL_MACI_IDFIRST + 11)
#define GIMI_PROTOCOL_MACI_BATTERY                  (GIMI_PROTOCOL_MACI_IDFIRST + 12)
#define GIMI_PROTOCOL_MACI_IMU                      (GIMI_PROTOCOL_MACI_IDFIRST + 13)
#define GIMI_PROTOCOL_MACI_WIRELESS                 (GIMI_PROTOCOL_MACI_IDFIRST + 14)
#define GIMI_PROTOCOL_MACI_AUCTION                  (GIMI_PROTOCOL_MACI_IDFIRST + 15)
#define GIMI_PROTOCOL_MACI_ENVIRONMENTMEASUREMENT   (GIMI_PROTOCOL_MACI_IDFIRST + 16)
#define GIMI_PROTOCOL_MACI_RECHARGER                (GIMI_PROTOCOL_MACI_IDFIRST + 17)
#define GIMI_PROTOCOL_MACI_TASKCTRL                 (GIMI_PROTOCOL_MACI_IDFIRST + 18)
#define GIMI_PROTOCOL_MACI_ENERGY                   (GIMI_PROTOCOL_MACI_IDFIRST + 19)
#define GIMI_PROTOCOL_MACI_SQL                      (GIMI_PROTOCOL_MACI_IDFIRST + 20)
#define GIMI_PROTOCOL_MACI_BEARING                  (GIMI_PROTOCOL_MACI_IDFIRST + 21)
#define GIMI_PROTOCOL_MACI_DUMMY                    (GIMI_PROTOCOL_MACI_IDFIRST + 22)
#define GIMI_PROTOCOL_MACI_OBJECTDB                 (GIMI_PROTOCOL_MACI_IDFIRST + 23)
#define GIMI_PROTOCOL_MACI_PARAMETER                (GIMI_PROTOCOL_MACI_IDFIRST + 24)
#define GIMI_PROTOCOL_MACI_AUDIO                    (GIMI_PROTOCOL_MACI_IDFIRST + 25)
#define GIMI_PROTOCOL_MACI_EMERGENCYSTOP            (GIMI_PROTOCOL_MACI_IDFIRST + 26)
#define GIMI_PROTOCOL_MACI_GIMBO                    (GIMI_PROTOCOL_MACI_IDFIRST + 27)
#define GIMI_PROTOCOL_MACI_UNIT                     (GIMI_PROTOCOL_MACI_IDFIRST + 28)

// New interface? Insert here following the naming format of the
// others, add _one_ to the previous ID.

#define GIMI_PROTOCOL_MACI_SERVERLAST               (GIMI_PROTOCOL_MACI_IDFIRST + 4999) // Last available service number
#define GIMI_PROTOCOL_MACI_CLIENTFIRST              (GIMI_PROTOCOL_MACI_IDFIRST + 5000) // First available service number
// All IDs between GIMI_PROTOCOL_MACI_CLIENTFIRST and
// GIMI_PROTOCOL_MACI_CLIENTLAST are reserved for autogenerated MaCI
// Service Client IDs.
#define GIMI_PROTOCOL_MACI_CLIENTLAST               (GIMI_PROTOCOL_MACI_IDFIRST + 9999)
#define GIMI_PROTOCOL_MACI_IDLAST                   (GIMI_PROTOCOL_MACI_IDFIRST + 9999) // Last ID is 40099
///////////////////////////////////////////////////////////////////////////////




////////////////////////////////////////////////////////////////////////////////
//// types used by Gimbo
////////////////////////////////////////////////////////////////////////////////
#define GIMI_PROTOCOL_GIMBO_FIRST                    (GIMI_ID_MIN + 40000)
#define GIMI_PROTOCOL_GIMBOCTRL                      (GIMI_PROTOCOL_GIMBO_FIRST)

///////////////////////////////////////////////////////////////////////////////
#endif // GIMI_PROTOCOL_TYPES_H
